package com.imddy.spbatch001.joblistener;

import com.imddy.spbatch001.entity.BlogInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.ItemReadListener;

/**
 * @author imddy
 * Description: 读取监听器
 */
public class MyReadListener implements ItemReadListener<BlogInfo> {
    private static final Logger log = LoggerFactory.getLogger(MyReadListener.class);


    @Override
    public void beforeRead() {
        log.info("beforeRead");
    }


    @Override
    public void afterRead(BlogInfo item) {
        log.info("afterRead");
        log.info("item={}", item);
    }


    @Override
    public void onReadError(Exception ex) {
        log.error("onReadError");
        log.error(ex.getMessage());
    }

}
